<template>
    <div>
      test {{ test() }}
      <Button @click="testDebounce">测试防抖</Button>
      <Button @click="testThrottle">测试节流</Button>
    </div>
  </template>
  
  <script>
  import _ from 'lodash'
  import debounce from 'lodash.debounce'
  
  export default {
    name: 'App',
    methods: {
      test () {
        return _.padStart(1, 2, '0')
      },
      testDebounce2: function () {
        console.log('I only get fired once every two seconds, max!')
      },
      testDebounce: debounce(() => {
        // testDebounce2()
        console.log(this)
      }, 2000),
      dd () { console.log('dd') },
      testThrottle () {
        console.log('2')
      },
      tt () { console.log('tt') },
      throttledMethod: debounce(() => {
        console.log('I only get fired once every two seconds, max!')
      }, 2000)
    }
  }
  // export default obj
  </script>
  
  <style>

  </style>
  